package com.activemq.demo;


import org.apache.activemq.command.ActiveMQTextMessage;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Session;

import lombok.extern.slf4j.Slf4j;


@Slf4j
@Component
public class CommunicationLogConsumer {

    public static final String CONSULTATION_RECORD_VIDEO_FILE = "dds";

    int count = 0;

    @JmsListener(destination = CONSULTATION_RECORD_VIDEO_FILE)
    public void receiveVideoTime(ActiveMQTextMessage message, Session session) throws JMSException {
        String s = message.getText();
        if (count == 20) {
            log.info(s + count + "手动回复，不再重发");
        } else {
            log.info(s + count+ "待重发");
            count++;
            session.rollback();
        }
    }

}